<?php 
class cls_control_order extends cls_control_base
{
	function get_all_order()
	{
		$order_serve = cls_serve_base::get_instance($this->name);
		if(!isset($_COOKIE['b2c_customerid']))
		{
			$notlogin = return_info(false, "登陆超时");
			echo json_encode($notlogin);
			return;
		}
		$customerid = $_COOKIE['b2c_customerid'];
	
		$result = $order_serve->get_all_order($customerid);
	
		echo json_encode($result);
	}
	
	function get_order_detail()
	{
		$order_serve = cls_serve_base::get_instance($this->name);
		if(!isset($_COOKIE['b2c_customerid']))
		{
			$notlogin = return_info(false, "登陆超时");
			echo json_encode($notlogin);
			return;
		}
		$customerid = $_COOKIE['b2c_customerid'];
		$orderid = $_REQUEST['orderid'];
	
		$orderid = mysql_real_escape_string($orderid);
		
		if(cls_control_base::check_if_empty($orderid))
		{
			$message = return_info(false, "没有指定订单ID");
			echo json_encode($message);
			return;
		}
		
		$result = $order_serve->get_order_detail($customerid, $orderid);
	
		echo json_encode($result);
	}
	
	function get_order_by_date_range()
	{
		$order_serve = cls_serve_base::get_instance($this->name);
		if(!isset($_COOKIE['b2c_customerid']))
		{
			$notlogin = return_info(false, "登陆超时");
			echo json_encode($notlogin);
			return;
		}
		$customerid = $_COOKIE['b2c_customerid'];
		$start_time = $_POST['starttime'];
		$end_time = $_POST['endtime'];
		
		$result = $order_serve->get_order_by_date_range($customerid, $start_time, $end_time);
		
		echo json_encode($result);
	}
}
?>